<template>
  <div>
    <h1>注册登录页面</h1>
    <p>注册账号：<input type="text" v-model="form.username"></p>
    <p>注册密码：<input type="text" v-model="form.password"></p>
    <button @click="teazc">确认注册</button>
    <br>
    <br>
    <br>
    <p>登录账号：<input type="text" v-model="aa.username"></p>
    <p>登录密码：<input type="text" v-model="aa.password"></p>
    <button @click="teadl">确认登录</button>
  </div>
</template>

<script>
export default {
  name: "tea",
  data() {
    return {
      form: {},
      aa: {}
    }
  },
  methods: {
    teazc() {
      this.$axios.post('users/TeaAPI/', this.form)
        .then(res => {
          if (res.data.code == 200) {
            alert('注册成功')

          } else {
            alert('注册失败')
          }
        })
    },
    teadl() {
      this.$axios.post('users/Tdl/', this.aa)
        .then(res => {
          if (res.data.code == 200) {
            alert(res.data.mes)
            localStorage.setItem('userid',res.data.userid)
            this.$router.push({path:'/stu'})
          } else {
            alert(res.data.mes)
          }
        })
    }
  }
}
</script>

<style scoped>

</style>
